package com.icss.service.impl;

import com.icss.dao.UserDao;
import com.icss.entity.User;
import com.icss.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
@Component
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao dao;
    @Override
    public List<User> selectAllUser() {
        Sort sort = Sort.by(Sort.Direction.DESC,"untreated");
        List<User> all = dao.findAll(sort);
        return all;

    }

    @Override
    public User selectUser(Integer userId) {
        User user = dao.findUserByUserId(userId);
        return user;
    }
}
